1. Field of the Invention
The present invention relates to a method, apparatus, and computer program for image data processing, and more particularly, to a method, apparatus, and computer program for image data processing enabling a reduction of memory consumption through efficient storage of compressed image data.
2. Discussion of the Background
Converting analog information into digital data is a typical method used to facilitate the handling of information in computer processing, transmission through optical fibers, and recording on or reading from a storage medium such as a memory disk. Information in the form of digital data is expressed using a discrete series of binary digits.
In information processing, data and signals can be transformed from one format into another through specific schemes so that the transformed information may be converted back into the original format or into a similar signal or data format. Such a process is called encoding.
There are different types of encoding schemes, such as encryption and compression, used to convert digital data into a form suitable for efficient manipulation. For example, in data compression, original data is converted into another form smaller in size without noticeable loss of information. Using data compression is effective in reducing consumption of resources, such as bandwidth and traffic for data transmission or memory space for data storage.
Various types of data compression techniques and formats have been designed and used for specific purposes, such as JPEG and Graphics Interchange Format (GIF) for image data, MPEG-1, MPEG-2, MPEG-4, MPEG-7, and MPEG-21, compression standards for audio-visual data using inter-frame prediction and DCT techniques, or MPEG-1 Audio Layer I (MP1), MPEG-1 Audio Layer II (MP2), and MPEG-1 Audio Layer III (MP3) for digitized audio data. In addition, as common compression utilities, ZIP and LHA are widely used on computer systems.
Using compression methods in data processing provides a reduction in data size, which is represented by a data compression ratio defined as a ratio between an original uncompressed size and a compressed size of data. The data compression ratio varies depending on the type of data file and the type of compression technique used to create a data file.
For example, pulse-code modulation (PCM) audio data can be compressed, with an acceptable level of quality, to compression ratios of approximately 11 by MP3, approximately 7 by MP2, and approximately 4 by MP1, respectively. By using ZIP and LHA methods, a text file can be compressed at a compression ratio of approximately 3 (to approximately 35% of the uncompressed size), a bitmap image file at a compression ratio of approximately 1.4 (to approximately 70% of the uncompressed size), and an executable file at a compression ratio of approximately 2 (to approximately 50% of the uncompressed size).
Among the aforementioned compression techniques, image data compression techniques have been applied to image processing methods for saving memory space. For example, GIF is a type of bit-mapped, general purpose graphics file format used on the World Wide Web (WWW). GIF encoding is suitable for processing images with a small number of colors, such as illustrations and button graphics, due to a high compression ratio in coding image data having large uniformly colored areas. In addition, JPEG is also effective in reducing memory consumption for storing and transmitting image data. In JPEG encoding, image data is split into 8×8 blocks, each of which is converted into frequency space using a two-dimensional forward discrete cosine transform (DCT). The result is quantized to reduce the amount of information, and then is compressed by an entropy coding. The entropy coding is a data compression scheme that assigns codes for symbols so as to match code lengths with the probabilities of the symbols.
In a common image processing method, image data acquired using an input device such as a scanner is encoded by a known compression technique to be stored in a memory space. In such encoding/storage process, the image data is transferred between the input device and the memory space using direct memory access (DMA), which does not involve calculation by a central processing unit (CPU), enabling the CPU to execute other tasks during data transmission. As the DMA transfer once set cannot be interrupted, an appropriate amount of memory for storing image data in an encoded form needs to be allocated prior to the DMA transfer.
In memory allocation, it is important to prevent errors caused by running out of memory. When additional memory space cannot be reserved during data transfer, allocating an insufficient amount of memory, e.g., several percents of the uncompressed size, may lead to out-of-memory conditions. As the compression ratio varies depending on the type of image data, a conventional image processing apparatus allocates a memory space that can store image data in an uncompressed form, ensuring the entire image data can be properly stored. However, this method causes a significant amount of wasted memory when stored image data is compressed at a high compression ratio.
To obviate such inefficiency, another conventional image processing apparatus has been designed, which allocates memory space of a given size while adjusting the compression ratio for encoding image data so as to store the entire image data within the allocated memory space. The apparatus compares an actual code size with a given reference at a given timing during a scanning operation. When the actual code size is larger than the given reference, the apparatus adjusts the compression ratio to make the code size equal to or smaller than the given reference. By doing so, the apparatus reduces an amount of wasted memory while eliminating the need for re-executing the scanning operation.
Such a method may provide increased efficiency in storing image data, but also has a drawback in terms of processing speed as scanning is suspended or decelerated for executing the adjustment of compression ratio. Thus, there exists a continuing need to develop an image processing apparatus achieving a reduction in memory consumption without sacrificing processing speed.